<%@page import="shmged.com.shlcm.utils.CmIBAHelper"%>
<%@page import="wt.doc.WTDocument"%>
<%@page import="wt.fc.ReferenceFactory"%>
<%@page import="shmged.com.shlcm.utils.CmShmgedType"%>
<%@page import="shmged.com.shlcm.utils.CmSettings"%>
<%@page import="wt.httpgw.URLFactory"%>
<%@page import="shmged.com.shlcm.utils.CmCreateDocHelper"%>
<%@page import="java.util.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
     String baseUrl = new URLFactory().getBaseHREF();
     String oid = request.getParameter("oid").trim();
     ReferenceFactory rf = new ReferenceFactory();
     WTDocument doc = (WTDocument)rf.getReference(oid).getObject();
     CmIBAHelper holder = new CmIBAHelper(doc);
     String title = doc.getName();
     String number=doc.getNumber();
     
     String showProjectSchButtion = CmCreateDocHelper.getProjectSch("/Default/项目管理/项目信息",number);
     List versionList=null;
     if(showProjectSchButtion!=null)
     {
    	versionList=CmCreateDocHelper.getAllVersion(showProjectSchButtion); 
     }
 	
     
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><%=title %></title>
</head>
<body>
<center>
<div style="width: 720px;">
<div class="easyui-panel" title="项目管理" style="height:800px">
	<div style="margin:10px 0;"></div>
	<center>
	<div class="easyui-tabs" style="width:700px;height:auto">
		<div title="项目信息" style="padding:10px">
			<form id="amCreateProject" method="post" action="<%=baseUrl %>shmged/jsp/com/shlcm/projects/createService.jsp" enctype="multipart/form-data" name="amCreateProject">
		    	<table border="1px" bordercolor="00BFFF" cellspacing="0px" style="border-collapse:collapse" class="easyui-panel" width="100%">
		    	     <tr>
				         <td rowspan=1 colspan=4  align=center  height="40">项目管理</td>
	   		        </tr>
		    		<tr>
		    			<td align="right">项目编号:</td>
		    			<td colspan="3"><%=doc.getNumber() %></td>
		    		</tr>
		    		<tr>
		    			<td align="right">项目名称:</td>
		    			<td colspan="3"><%=doc.getName() %></td>
		    		</tr>
		    		<tr>
		    			<td align="right">发起人:</td>
		    			<td><%=holder.getIBAValueNull2Blank("PersonalNo") %></td>
		    			<td align="right">项目经理:</td>
		    			<td width="200"><%=holder.getIBAValueNull2Blank("ManagerNo") %></td>
		    		</tr>
		    		<tr>
		    			<td align="right">合同编号:</td>
		    			<td colspan="3"><%=holder.getIBAValueNull2Blank("ContactNo") %></td>
		    		</tr>
		    		<tr>
		    			<td align="right">工程分类:</td>
		    			<td colspan="3"><%=holder.getIBAValueNull2Blank("ProjectProperties") %></td>
		    		</tr>
		    		<tr>
		    			<td align="right">工程简介:</td>
		    			<td colspan="3"><%=holder.getIBAValueNull2Blank("ProjectDescription") %></td>
		    		</tr>
		    	</table>
		    </form>
		</div>
		<div title="承包商/业主信息" style="padding:10px">
		</div>
		<div title="项目计划"  style="padding:10px;height:auto">
			
					<div><jsp:include page="createProjectSchedule.jsp"></jsp:include></div>
					<div style="margin:10px 0;"></div>
					<div class="easyui-layout" style="width:680px;height:750px;">
					<div style="padding:5px;">
						<%if(!showProjectSchButtion.equals(""))
						{
						%>
						<div><jsp:include page="updateProjectSchedule.jsp">
						<jsp:param value="<%=showProjectSchButtion %>" name="projectScheduleOid" />
					    </jsp:include></div>
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="browseUpdateProjectSchedule()">修改项目计划</a>&nbsp;历史版本：
						
						<% for(int j=0;j<versionList.size();j++){
							Map map=(Map)versionList.get(j);
							%>
							<a href="javaScript:void(0)" onclick="initProjectScheduleTable('/Default/项目管理/技术文档/技术培训','<%=map.get("oldOid") %>')"><%=map.get("version") %></a>&nbsp;|
							<%
						} %>
						<%
						}else{
						%>
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="browseCreateProjectSchedule()">创建项目计划</a>
						<%} %>
					</div>
				
					<center>
					      <table id="ttProjectSchedule"></table>
					</center>
					</div>
			
			
		</div>
		<div title="项目费用"  style="padding:10px">
		<jsp:include page="projectExpense.jsp">
		<jsp:param name="number" value="<%=number%>"/>
		</jsp:include>
		</div>
		<div title="技术文档"  style="padding:10px">
					<div><jsp:include page="createProjectDoc.jsp"></jsp:include></div>
					<div style="margin:10px 0;"></div>
					<div class="easyui-layout" style="width:680px;height:750px;">
					<div style="padding:5px;">
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'" onclick="browseCreateProjectDoc()">创建技术文档</a>
					</div>
					<center>
					 <table id="ttProjectDoc"></table>
					 </center>
					</div>
		</div>
	</div>
	</center>
</div>
</div>
</center>
<script>
		//初始化table
		initProjectScheduleTable("/Default/项目管理/项目信息","");
		initProjectDocTable("/Default/项目管理/技术文档/技术培训");
		function initProjectScheduleTable(folderName,oldOid){
			var url='<%=baseUrl%>shmged/jsp/com/shlcm/projects/jspProjectSchedule.jsp';
			var number='<%=number%>';
			  $('#ttProjectSchedule').datagrid({   
			      url:url,
			      queryParams:{folderName:folderName,info:"项目进度",projectNo:number,oldOid:oldOid},
			      nowrap:false,
			      loadMsg:'正在加载数据，请稍等。。。',
				  fitColumns: true,
			      columns:[[   
			                {field:'id',title:'序号',width:10,
					        	  //添加超级链 
			                     formatter:function(value,rowData,rowIndex){
			                    		 return rowIndex;  
					          		}
						       },
					          {field:'name',title:'任务名称',width:60},
					          {field:'creator',title:'负责人',width:60},
					          {field:'startTime',title:'计划开始时间',width:60},
					          {field:'endTime',title:'计划结束时间',width:60},
					          {field:'actualStartTime',title:'实际开始时间',width:60},
					          {field:'actualEndTime',title:'实际结束时间',width:60},
					          {field:'state',title:'任务状态',width:60},
					          {field:'desc',title:'执行情况',width:60}
			      ]] 
			    }); 
		}


		
		function initProjectDocTable(folderName){
			var number='<%=number%>';
			var url='<%=baseUrl%>shmged/jsp/com/shlcm/projects/jspProjectDocs.jsp';
			  $('#ttProjectDoc').datagrid({   
			      url:url,
			      queryParams:{folderName:folderName,projectNo:number},
			      nowrap:false,
			      loadMsg:'正在加载数据，请稍等。。。',
				  fitColumns: true,
			      columns:[[   
						{field:'id',title:'id',width:100,checkbox:true},  
						{field:'type',title:'类型',width:15}, 
						{field:'name',title:'名称',width:50,
							  //添加超级链 
						   formatter:function(value,rowData,rowIndex){
								if(rowData.number!=""){
						  		 return "<a href='javaScript:void(0)' onclick=\"javaScript:addTab('','','"+rowData.id+"','"+rowData.name+"')\">"+rowData.name+"</a>";  
								}else{
									  return "<a href='javaScript:void(0)' onclick=\"javaScript:expandTo('"+rowData.name+"')\">"+rowData.name+"</a>";
									}
						
						}
						
						    },
						{field:'state',title:'状态',width:40}, 
						{field:'version',title:'版本',width:40},
						{field:'modifyUser',title:'更新者',width:60},
						{field:'time',title:'更新时间',width:100}   
			      ]] 
			    }); 
		}

		function browseOldProjectSchedule(oid)
		{

		}
	</script>
</body>
</html>